package redis

import (
	"github.com/redis/go-redis/extra/redisotel/v9"
	"github.com/redis/go-redis/v9"
	"time"
)

func NewRedisClusterClient(addrs []string, password string) *redis.ClusterClient {
	redisOption := &redis.ClusterOptions{
		Addrs:       addrs,
		Password:    password,
		MaxRetries:  3,
		PoolSize:    10000,
		PoolFIFO:    true,
		PoolTimeout: 3 * time.Second,
	}
	rdb := redis.NewClusterClient(redisOption)
	// 启用 tracing
	if err := redisotel.InstrumentTracing(rdb); err != nil {
		panic(err)
	}
	return rdb
}
